<?php
namespace app\web\controller;

use controller\BasicWeb;
use think\Request;
use app\common\model\Gits;
use app\common\model\BcnGits;
use app\common\model\BcnCourses;
use app\common\model\BcnCurrencys;
use app\common\model\BcnConsultations;
use app\common\model\BcnCompanys;
use app\common\model\BcnHots;

class Git extends BasicWeb
{
    protected $auth_type = 4;
    
    public function index(Request $request)
    {
        $data['git'] = BcnGits::field('url,title,introduction,label,star')->where('status',2)->select();
        $data['course'] = BcnCourses::field('url,title,introduction,label')->where('status',2)->select();
        $data['currency'] = BcnCurrencys::field('market,latestrice,ups,highest,minimum,volume,turnover')->select();
        $data['consultation'] = BcnConsultations::field('logo,title,introduction,label,url')->where('status',2)->select();
        $data['company'] =  BcnCompanys::field('headimg,title,introduction,label,url')->where('status',2)->select();
        $datas = BcnHots::select()->toArray();
        $array = [];
        foreach ($datas as $k=>$v){
            $array[] = BcnGits::field('url,title,introduction,label,star')->where('id',$v['bigv_id'])->where('status',2)->select()->toArray();
            $array[] = BcnCourses::field('url,title,introduction,label')->where('id',$v['bigv_id'])->where('status',2)->select()->toArray();
            $array[] = BcnConsultations::field('logo,title,introduction,label,url')->where('id',$v['bigv_id'])->where('status',2)->select()->toArray();
            $array[] = BcnCompanys::field('headimg,title,introduction,label,url')->where('id',$v['bigv_id'])->where('status',2)->select()->toArray();
        }
        $this->success(['data'=>$data,'hot'=>$array]);
    }
}